<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title></title>
    <!-- 引入ElementUI样式 -->
    <link type="text/css" rel="stylesheet" href="../css/index.css">
    <!-- 引入Vue组件库 -->
    <script type="text/javascript" src="../js/vue.js"></script>
    <!-- 引入ElementUI组件库 -->
    <script type="text/javascript" src="../js/index.js"></script>
    <script type="text/javascript" src="../js/axios.min.js"></script>
    <style>
        .yydh {width: 350px;height: 40px;margin-left: -20px;background-color: #77c588;border-radius: 15px;color: cornsilk;line-height: 40px;}
        .box-card{margin-bottom: 20px}
        .header{font-size: 28px;font-width: bolder;text-align: center;margin: 20px 0;}
        .qxdd{float: right;margin: -20px 20px 20px 0;}
        #wuData{height: 200px;line-height: 200px;font-size: 24px;color: crimson;text-align: center;}
        .quit{margin-top: -40px;float: right;color: chocolate;display: block;}
    </style>
</head>
<body>
<div id="app">
    <el-row>
        <el-col :span="18" :offset="3"><div class="grid-content">
            <div class="header">请核对查询的结果</div>
            <div class="quit">
                <el-link :underline="false" type="danger" @click="quit()">退出</el-link>
            </div>
            <div v-for="item in data">
                <el-card class="box-card" shadow="never">
                    <div class="yydh"><i class="el-icon-star-on"></i>订单号：{{item.reservation.pnum}}</div>
<%--                    <span class="qxdd"> <el-button type="danger" size="medium" round @click="open(item.reservation.id)">取消订单</el-button></span>--%>
                    <el-descriptions>
                        <el-descriptions-item label="预约人">{{item.reservation.name}}</el-descriptions-item>
                        <el-descriptions-item label="年龄">{{item.reservation.age}}</el-descriptions-item>
                        <el-descriptions-item label="就诊医生">{{item.accountName}}</el-descriptions-item>
                        <el-descriptions-item label="预约时间">{{item.reservation.createTime}}</el-descriptions-item>
                        <el-descriptions-item label="就诊时间">{{item.reservation.visitTime}}</el-descriptions-item>
                        <el-descriptions-item label="预约科室">{{item.sectionName}}</el-descriptions-item>
                        <el-descriptions-item label="备注">
                            <el-tag size="small"  type="info" v-if="item.reservation.isdelete == 1 ">取消预约</el-tag>
                            <el-tag size="small"  v-if="item.reservation.isdelete == 0 && item.reservation.isvisit == 0 ">预约成功</el-tag>
                            <el-tag size="small" type="success" v-if="item.reservation.isdelete == 0 && item.reservation.isvisit == 1 ">已问诊</el-tag>
                            <el-tag size="small" type="danger" v-if="item.reservation.isdelete == 0 && item.reservation.isvisit == 2 ">问诊已过期</el-tag>
                        </el-descriptions-item>
                    </el-descriptions>
                    <span class="qxdd" v-if="item.reservation.isdelete == 0 && item.reservation.isvisit == 1 ">
                        <el-button type="danger" size="medium" round @click="selectDisease(item.reservation.id)">查看病例单</el-button>
                         <el-button type="primary" size="medium" round @click="selectDown(item.reservation.id)">下载病例单</el-button>
                    </span>
                </el-card>
            </div>
            <div id="wuData" v-show="data.length == 0">暂无该患者数据！</div>
        </div></el-col>


    </el-row>
    <el-dialog
            title="处理病例的信息"
            :visible.sync="dialogVisible2"
            width="80%"
    >
        <el-card class="box-card" v-if="!isFlag">
            <el-descriptions title="病例信息" >
                <el-descriptions-item label="病情">{{visitForm.cases}}</el-descriptions-item>
                <el-descriptions-item label="医生建议">{{visitForm.suggest}}</el-descriptions-item>
            </el-descriptions>
        </el-card>


        <span slot="footer" class="dialog-footer">
                 <el-button type="primary" icon="el-icon-close" @click="dialogVisible2 = false">关闭</el-button>
           </span>
    </el-dialog>

</div>


<script>
    new Vue({
        el: "#app",
        data: {
            data:[],
            timer:null,
            dialogVisible2:false,
            isFlag:true,
            visitForm:{}
        },
        created() {
           this.getParams();
        },
        methods: {

            selectDown(rid){
                axios.post("/download?reservationId="+rid).then(resp=>{
                    location.href="/download?reservationId="+rid;
                });
            },


            selectDisease(rid){
                axios.post("/ReservationQian/selectByReservationId?reservationId="+rid).then(resp=>{
                   this.dialogVisible2=true;
                    if(resp.data.code === 200){
                        this.visitForm=resp.data.data;
                        this.isFlag = false;
                    }else{
                        this.visitForm = {};this.isFlag = true;
                    }
                });

            },
            getParams(){
                axios.get("/ReservationQian/queryList").then(resp=>{
                    this.data = resp.data.data;
                })
            },
            quit(){
                axios.get("/ReservationQian/quitCancel").then(resp=>{
                    clearTimeout(this.timer); //清除延迟执行
                    this.timer = setTimeout(()=>{  //设置延迟执行
                        location.href  = "resultSelect.jsp";
                    },1000);
                })
            }
        },
    })
</script>

</body>
</html>